package com.ryskoo.operation.message.repository;

import com.ryskoo.common.constant.CacheConstant;
import com.ryskoo.framework.core.repository.BasicRedisImpl;
import com.ryskoo.framework.core.utils.RedisUtil;
import com.ryskoo.operation.message.domain.MessagePO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;

@Primary
@Repository
public class MessageRedisImpl extends BasicRedisImpl<MessagePO> implements IMessageRepository{

    /**
     * 留言缓存KEY
     */
    private static final String cacheKey = CacheConstant.OPERATION_WEBSITE_MESSAGE_KEY;

    @Autowired
    private RedisUtil redisClient;

    @Autowired
    private IMessageRepository messageRepository;

    @PostConstruct
    public void init(){
        this.setDao(messageRepository);
        this.setRedisClient(redisClient);
    }

    public MessageRedisImpl() { super (cacheKey);}
}
